package psd.model.Prolog.Converters;

import org.eclipse.jdt.core.dom.EnumConstantDeclaration;

import psd.model.IConverter;
import psd.model.Prolog.FactGenerationToolbox;
import psd.model.Prolog.PrologConverter;


public class PrologEnumConstantDeclarationConverter extends PrologConverter
implements IConverter<EnumConstantDeclaration>{

	public PrologEnumConstantDeclarationConverter(
			FactGenerationToolbox toolbox) {
		super(toolbox);
	}

	@Override
	public boolean convert(EnumConstantDeclaration node) {
	    String id = idResolver.getID(node);
        String parentId = getParentId(node);
        String encl = idResolver.getID(getEnclosingNode(node));
        String name = quote(node.getName());
        String enumArgs = idResolver.getIDs(node.arguments());
        String args[] = {
            id, parentId, encl, name, enumArgs, this.getFilePath(node), this.getLineNumber(node)
        };
        writer.writeFact("enumConstantT", args);
        writer.writeFact("slT", new String[] {
            idResolver.getID(node), Integer.toString(node.getStartPosition()), Integer.toString(node.getLength()), this.getFilePath(node), this.getLineNumber(node)
        });
        checkAndGenComments(node, id);
        checkAndGenComments(node, idResolver.getID(node));
        return true;
	}

}
